#include <iostream>
#include "timewheel.hpp"

class Test
{
public:
    Test() { std::cout << "构造" << std::endl; }
    ~Test() { std::cout << "析构" << std::endl; }
};

void DelTest(Test *t)
{
    delete t;
}

int main()
{
    TimeWheel tw;
    Test* t = new Test();
    tw.TimerAdd(888, 3, std::bind(DelTest, t));
    for(int i = 0; i < 5; i++)
    {
        sleep(1);
        tw.TimeRefresh(888);
        tw.RunTimerTask();
        std::cout << "Test 定时任务被重新定时执行" << std::endl;
    }
    while(true)
    {
        sleep(1);
        std::cout <<"tick 移动了一部" << std::endl;
        tw.RunTimerTask();
    }
    return 0;
}